class Solution {
public:
    int numOfSubarrays(vector<int>& arr, int k, int threshold) {
        int n=arr.size();
        int ans=0;
        double sum=0;
        for(int i=0;i<k;++i) sum+=arr[i];
        if(sum/k>=threshold) ++ans;
        for(int i=k;i<n;++i)
        {
            sum=sum-arr[i-k]+arr[i];
            if(sum/k>=threshold) ++ans;
        }
        return ans;
    }
};